<?php
/**
 * Загрузчик web-окружения
 * 
 * @author naspeh
 * @version $Id: web.php 666 2008-06-30 08:22:59Z naspeh $
 */
$timeStarted = microtime(1);
 
include 'setup.php';

error_reporting(E_ALL | E_STRICT);

$path = array(
    DIR_LIBRARY,
    DIR_MODULES . 'core/models',
    );
set_include_path(implode(PATH_SEPARATOR, $path));

require_once 'Loader.php';
Core_Loader::registerAutoload();
Core_Loader::addDir(DIR_LIBRARY);
Core_Loader::addDir(DIR_MODULES, 'models');
Core_Loader::addDir(DIR_MODULES, 'controllers');
Core_Loader::addDir(DIR_MODULES, 'views' . DIRECTORY_SEPARATOR . 'helpers');    
Core_Loader::setModuleDir(DIR_MODULES);

Zend_Session::start();
$config = implode(DIRECTORY_SEPARATOR, array(DIR_MODULES . Core_Loader::MODULE_DEFAULT,  Core_Loader::SUFFIX_CONFIGS, 'common'));
if (is_file($config . '.local.php')) {
    $config = new Zend_Config(include $config . '.local.php');
} else {
    $config = new Zend_Config(include $config . '.php');
}    
Core_Log::setOptions($config->log);
Core_Cache::setOptions($config->cache);    
Core_Config::setOptions($config->config);
Core_Acl::start();
Core_Controller_Front::getInstance()->start();

Core_Log::dump(microtime(1)- $timeStarted, 'Time of load');
Core_Log::echoDebug();